Oil Refinery Production Model Code
to simulate a refinery's Distillation units
in one run.
Goal for this page: simulate a refinery's entire number of Distillation units in one run.
On this page, we'll show the few code changes necessary to simulate an entire refinery in one run.
1. To start, set iRefinery = 'i'th refinery unit and make a test run ... are results lookin' good? If so, continue to another 'i'th refinery; if not, fix model or whatever needs fixing to get agreement with present production results. Next, change 'iRefinery' refinery setting to another refinery and step through all it's Distillation units until all are working properly and results agree with what is presently being produced.
iRefinery = 2
2. The 'iRefinery' statement must be entered before a call to the 'processing' statement is executed as shown below.
model departments
iRefinery = 2 ! must change for each refinery
call processing ! distillation model for 'i'th Refinery
call inventory ! present supply of various products
ooo
End
3. Build the Processing model that states how the crude oil is broken down into the sellable oil units; e.g., 10, 20, 30, 90 grades. Think distribution! Where are the different grades to be sold? Heavy grades in the cold parts and light grades in the hot parts of the country. So, in order to help minimize cost, produce the oil products in their appropriate regions.
Processing model is the only one necessary to get things rolling.
model Processing ! All distillation units @ 'i'th refinery
i = iRefinery
! assume distillation requires solving a PDE or two.
! below is the bases for solving a PDE.
t = 0: tPrt = tPrint
do j = 1, nDistillUnits(i)
Initiate ISIS for PDEquations ooo
do while (t .lt. tFinal)
Integrate PDEquations by ISIS
if( t .ge. tPrt) print 79, t, (U(ii),ii = 1,ip)
tPrt = tPrt + tPrint
end do
end do
crudeErr = crudeErr+(totCrudeIn(i, j)– crudeUsed)**2
79 format( 1x,f8.4,20(g14.5, 1x))
end
model PDEquations
if( j .eq. 1) then
pde_1 = pde equations with parameters
! assume # 3, 7, & 8 products are created
qtyProd(3) = qtyProd(3) + ???
qtyProd(7) = qtyProd(7) + ???
qtyProd(8) = qtyProd(8) + ???
elseif( j .eq. 2) then
pde_2 = pde equations with parameters
! assume # 2 & 8 products are created
qtyProd(2) = qtyProd(2) + ???
qtyProd(8) = qtyProd(8) + ???
ooo
end if
crudeUsed = crudeUsed + ???
pollution = pollution + ???
cost = cost + mfgCost + distCost + ???
profit = profit + ??? - cost
end
The next article will show ALL refineries being executed in one run.